<?php
// 定义奖品列表
$prizes = [
    "一等奖：iPhone 15",
    "二等奖：iPad Air",
    "三等奖：智能手表",
    "幸运奖：精美礼品一份",
    "未中奖：再接再厉"
];

// 处理抽奖请求
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $randomIndex = array_rand($prizes);
    $result = $prizes[$randomIndex];
}
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>抽奖游戏</title>
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <div class="container">
        <h1>抽奖游戏</h1>
        <?php if (isset($result)): ?>
            <div class="result">
                <p>抽奖结果：<?php echo $result; ?></p>
            </div>
        <?php endif; ?>
        <form method="post">
            <button type="submit">点击抽奖</button>
        </form>
    </div>
    <script src="script.js"></script>
</body>

</html>